Uses for Tag Objects
Tags were originally devised as generalized, object-based equivalents to QuickDraw picture comments. Picture comments are used for sending PostScript commands during printing and for other purposes. A tag is like a structured comment: it has a specific type, it is attached to a specific item (an object), and it has a specific scope (that object).Tag objects can, however, be used for more than picture comments. For example, tags can provide general information. For a large, complex document that can be represented as a single picture shape, it may be important to know what application originally created the shape, or what ranges of properties (colors, pixel depths, page sizes, and so on) may be found in it. The shape may contain one or more references to tag objects that hold that information.
You can also use tags to attach identifying strings to objects, for debugging or
other purposes. You could name shapes with strings like "oval" or "topographic
contour 3242"; you could name ink objects with strings like "cobalt blue" or "blend mode." You could also use tag objects to attach user comments or descriptions to shapes.Tag objects may also provide alternate behavior for an object when it is used outside the QuickDraw GX environment. For example, QuickDraw GX uses tag objects to store PostScript commands for drawing shapes to PostScript printers.
If you want to be able to draw a shape object on a system that uses a different coordinate system from QuickDraw GX, you could calculate and store the alternate coordinates in a tag attached to the shape. If you are working in a completely different graphics system that is a superset of QuickDraw GX, you could store that system's graphics information as tag objects attached to the QuickDraw GX objects you create.
- IMPORTANT
- In most cases, an application-created tag object cannot change the behavior of its associated object within the QuickDraw GX environment. No geometric operations, no drawing operations, and no testing operations (such as
GXEqualShape
) take the existence of tag objects into account. (One minor exception isGXFlattenShape
; see its description in the chapter "Shape Objects" in this book. A second exception is that drawing a bitmap whose pixel image is disk-based requires QuickDraw GX to use information in a tag object.) Other than that, tag objects can alter behavior only where graphics operations are overridden (as in printing), or where your application itself changes an operation based on the contents of a tag object.![]()